<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**
         * 将JSON对象转换为字符串
         */ 
        var person={
            "name":"汤小洋",
            "age":18,
            "height":180.5
        };
        console.log(typeof person)
        console.log(person)

        var str = JSON.stringify(person)
        console.log(typeof str)
        console.log(str)

        /**
         * 将字符串转换为JSON对象
         */
        var obj = JSON.parse(str)
        console.log(typeof obj)
        console.log(obj)


        /**
         * 对象字面量
         */ 
        var stu = {
            name:'张三',
            age:18,
            height:180.5,
            run:function(){
                console.log('正在跑步。。。。。')
            },
            study:function(){
                console.log('正在学习。。。。。')
            }
        }
        console.log(stu.name, stu.age)
        stu.run()
        stu.study()
    </script>
</body>
</html>